E 您所在的位置:网站首页 ncbi api key怎么用 E

E

2023-06-22 23:32| 来源: 网络整理| 查看: 265

Release Notes

Please see our Release Notes for details on recent changes and updates.

Announcement

On December 1, 2018, NCBI will begin enforcing the use of new API keys for E-utility calls. Please see Chapter 2 for more details about this important change.

Introduction

This chapter provides a brief overview of basic E-utility functions along with examples of URL calls. Please see Chapter 2 for a general introduction to these utilities and Chapter 4 for a detailed discussion of syntax and parameters.

Examples include live URLs that provide sample outputs.

All E-utility calls share the same base URL:

https://eutils.ncbi.nlm.nih.gov/entrez/eutils/Searching a DatabaseBasic Searchingesearch.fcgi?db=&term=

Input: Entrez database (&db); Any Entrez text query (&term)

Output: List of UIDs matching the Entrez query

Example: Get the PubMed IDs (PMIDs) for articles about breast cancer published in Science in 2008

https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=pubmed&term=science[journal]+AND+breast+cancer+AND+2008[pdat]

Storing Search Resultsesearch.fcgi?db=&term=&usehistory=y

Input: Any Entrez text query (&term); Entrez database (&db); &usehistory=y

Output: Web environment (&WebEnv) and query key (&query_key) parameters specifying the location on the Entrez history server of the list of UIDs matching the Entrez query

Example: Get the PubMed IDs (PMIDs) for articles about breast cancer published in Science in 2008, and store them on the Entrez history server for later use

https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=pubmed&term=science[journal]+AND+breast+cancer+AND+2008[pdat]&usehistory=y

Associating Search Results with Existing Search Resultsesearch.fcgi?db=&term=&usehistory=y# esearch produces WebEnv value ($web1) and QueryKey value ($key1) esearch.fcgi?db=&term=&usehistory=y&WebEnv=$web1# esearch produces WebEnv value ($web2) that contains the results of both searches ($key1 and $key2)

Input: Any Entrez text query (&term); Entrez database (&db); &usehistory=y; Existing web environment (&WebEnv) from a prior E-utility call

Output: Web environment (&WebEnv) and query key (&query_key) parameters specifying the location on the Entrez history server of the list of UIDs matching the Entrez query

For More Information

Please see ESearch In-Depth for a full description of ESearch.

Sample ESearch Output255147 # total number of records matching query20# number of UIDs returned in this XML; default=200# index of first record returned; default=01# QueryKey, only present if &usehistory=y0l93yIkBjmM60UBXuvBvPfBIq8-9nIsldXuMP0hhuMH-8GjCz7F_Dz1XL6z@397033B29A81FB01_0038SID # WebEnv; only present if &usehistory=y 229486465 # list of UIDs returned229486321229485738229470359229463047229463037229463022229463019229463007229463002229463000229462974229462961229462956229462921229462905229462899229462873229462863229462862 # details of how Entrez translated the query mouse[orgn] "Mus musculus"[Organism] "Mus musculus"[Organism] Organism 255147 Y GROUP"Mus musculus"[Organism]Searching PubMed with Citation Dataecitmatch.cgi?db=pubmed&rettype=xml&bdata=

Input: List of citation strings separated by a carriage return (%0D), where each citation string has the following format:

journal_title|year|volume|first_page|author_name|your_key|

Output: A list of citation strings with the corresponding PubMed ID (PMID) appended.

Example: Search PubMed for the following ciations:

Art1: Mann, BJ. (1991) Proc. Natl. Acad. Sci. USA. 88:3248

Art2: Palmenberg, AC. (1987) Science 235:182

https://eutils.ncbi.nlm.nih.gov/entrez/eutils/ecitmatch.cgi?db=pubmed&retmode=xml&bdata=proc+natl+acad+sci+u+s+a|1991|88|3248|mann+bj|Art1|%0Dscience|1987|235|182|palmenberg+ac|Art2|

Sample Output (the PMIDs appear in the rightmost field):

proc natl acad sci u s a|1991|88|3248|mann bj|Art1|2014248science|1987|235|182|palmenberg ac|Art2|3026048

Please see ECitMatch In-Depth for a full description of ECitMatch.

Uploading UIDs to EntrezBasic Uploadingepost.fcgi?db=&id=

Input: List of UIDs (&id); Entrez database (&db)

Output: Web environment (&WebEnv) and query key (&query_key) parameters specifying the location on the Entrez history server of the list of uploaded UIDs

Example: Upload five Gene IDs (7173,22018,54314,403521,525013) for later processing.

https://eutils.ncbi.nlm.nih.gov/entrez/eutils/epost.fcgi?db=gene&id=7173,22018,54314,403521,525013

Associating a Set of UIDs with Previously Posted Setsepost.fcgi?db=&id=# epost produces WebEnv value ($web1) and QueryKey value ($key1)epost.fcgi?db=&id=&WebEnv=$web1# epost produces WebEnv value ($web2) that contains the results of both posts ($key1 and $key2)

Input: List of UIDs (&id); Entrez database (&db); Existing web environment (&WebEnv)

Output: Web environment (&WebEnv) and query key (&query_key) parameters specifying the location on the Entrez history server of the list of uploaded UIDs

For More Information

Please see EPost In-Depth for a full description of EPost.

Sample EPost Output1NCID_01_268116914_130.14.18.47_9001_1241798628Downloading Document SummariesBasic Downloadingesummary.fcgi?db=&id=

Input: List of UIDs (&id); Entrez database (&db)

Output: XML DocSums

Example: Download DocSums for these protein GIs: 6678417,9507199,28558982,28558984,28558988,28558990

https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esummary.fcgi?db=protein&id=6678417,9507199,28558982,28558984,28558988,28558990

Downloading Data From a Previous Searchesearch.fcgi?db=&term=&usehistory=y# esearch produces WebEnv value ($web1) and QueryKey value ($key1)esummary.fcgi?db=&query_key=$key1&WebEnv=$web1

Input: Web environment (&WebEnv) and query key (&query_key) representing a set of Entrez UIDs on the Entrez history server

Output: XML DocSums

Sample ESummary Output

The output of ESummary is a series of XML “DocSums” (Document Summaries), the format of which depends on the database. Below is an example DocSum for Entrez Protein.

15718680NP_005537IL2-inducible T-cell kinase [Homo sapiens]gi|15718680|ref|NP_005537.3|[15718680]157186801999/06/092009/04/055129606620liveSample ESummary version 2.0 Output

Version 2.0 of ESummary is an alternate XML presentation of Entrez DocSums. To retrieve version 2.0 DocSums, the URL should contain the &version parameter with an assigned value of ‘2.0’. Each Entrez database provides its own unique DTD for version 2.0 DocSums, and a link to the relevant DTD is provided in the header of the version 2.0 XML.

esummary.fcgi?db=&id=&version=2.0

Below is an example version 2.0 DocSum from Entrez Protein (the same record as shown above in the default DocSum XML).

NP_005537 tyrosine-protein kinase ITK/TSK [Homo sapiens] gi|15718680|ref|NP_005537.3| 15718680 1999/06/09 2011/10/09 512 9606 620 aa linear refseq 0 0 genomic chromosome|map 5|5q31-q32 399658 D13720.1 1 Homo sapiens NP_005537.3 2 NP_005537.3 Downloading Full RecordsBasic Downloadingefetch.fcgi?db=&id=&rettype=&retmode=

Input: List of UIDs (&id); Entrez database (&db); Retrieval type (&rettype); Retrieval mode (&retmode)

Output: Formatted data records as specified

Example: Download nuccore GIs 34577062 and 24475906 in FASTA format

https://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?db=nuccore&id=34577062,24475906&rettype=fasta&retmode=text

Downloading Data From a Previous Searchesearch.fcgi?db=&term=&usehistory=y# esearch produces WebEnv value ($web1) and QueryKey value ($key1)efetch.fcgi?db=&query_key=$key1&WebEnv=$web1&rettype=&retmode=

Input: Entrez database (&db); Web environment (&WebEnv) and query key (&query_key) representing a set of Entrez UIDs on the Entrez history server; Retrieval type (&rettype); Retrieval mode (&retmode)

Output: Formatted data records as specified

Downloading a Large Set of Records

Please see Application 3 in Chapter 3

Input: Entrez database (&db); Web environment (&WebEnv) and query key (&query_key) representing a set of Entrez UIDs on the Entrez history server; Retrieval start (&retstart), the first record of the set to retrieve; Retrieval maximum (&retmax), maximum number of records to retrieve

Output: Formatted data records as specified

For More Information

Please see EFetch In-Depth for a full description of EFetch.

Finding Related Data Through Entrez LinksBasic LinkingBatch mode – finds only one set of linked UIDselink.fcgi?dbfrom=&db=&id=

Input: List of UIDs (&id); Source Entrez database (&dbfrom); Destination Entrez database (&db)

Output: XML containing linked UIDs from source and destination databases

Example: Find one set of Gene IDs linked to nuccore GIs 34577062 and 24475906

https://eutils.ncbi.nlm.nih.gov/entrez/eutils/elink.fcgi?dbfrom=nuccore&db=gene&id=34577062,24475906

‘By Id’ mode – finds one set of linked UIDs for each input UIDelink.fcgi?dbfrom=&db=&id=&id=&id=...

Example: Find separate sets of Gene IDs linked to nuccore GIs 34577062 and 24475906

https://eutils.ncbi.nlm.nih.gov/entrez/eutils/elink.fcgi?dbfrom=nuccore&db=gene&id=34577062&id=24475906

Note: &db may be a comma-delimited list of databases, so that elink returns multiple sets of linked UIDs in a single call

Finding Links to Data from a Previous Searchesearch.fcgi?db=&term=&usehistory=y# esearch produces WebEnv value ($web1) and QueryKey value ($key1)elink.fcgi?dbfrom=&db=&query_key=$key1&WebEnv=$web1&cmd=neighbor_history

Input: Source Entrez database (&dbfrom); Destination Entrez database (&db); Web environment (&WebEnv) and query key (&query_key) representing the set of source UIDs on the Entrez history server; Command mode (&cmd)

Output: XML containing Web environments and query keys for each set of linked UIDs

Note: To achieve ‘By Id’ mode, one must send each input UID as a separate &id parameter in the URL. Sending a WebEnv/query_key set always produces Batch mode behavior (one set of linked UIDs).

Finding Computational Neighbors Limited by an Entrez Searchelink.fcgi?dbfrom=&db=&id=&term=&cmd=neighbor_history

Input: Source Entrez database (&dbfrom); Destination Entrez database (&db); List of UIDs (&id); Entrez query (&term); Command mode (&cmd)

Output: XML containing Web environments and query keys for each set of linked UIDs

Example: Find protein UIDs that are rat Reference Sequences and that are sequence similar to GI 15718680

https://eutils.ncbi.nlm.nih.gov/entrez/eutils/elink.fcgi?dbfrom=protein&db=protein&id=15718680&term=rat[orgn]+AND+srcdb+refseq[prop]&cmd=neighbor_history

For More Information

Please see ELink In-Depth for a full description of ELink.

Getting Database Statistics and Search Fieldseinfo.fcgi?db=

Input: Entrez database (&db)

Output: XML containing database statistics

Note: If no database parameter is supplied, einfo will return a list of all valid Entrez databases.

Example: Find database statistics for Entrez Protein.

https://eutils.ncbi.nlm.nih.gov/entrez/eutils/einfo.fcgi?db=protein

For More Information

Please see EInfo In-Depth for a full description of EInfo.

Sample EInfo OutputproteinProteinProtein sequence record267150922009/05/12 04:39ALLAll FieldsAll terms from all searchable fields133639432NNNNN...PORGPrimary OrganismScientific and common names of primary organism, and all higher levels of taxonomy673555NNYYNprotein_biosystemsBioSystem LinksBioSystemsbiosystems...protein_unigeneUniGene LinksRelated UniGene recordsunigenePerforming a Global Entrez Searchegquery.fcgi?term=

Input: Entrez text query (&term)

Output: XML containing the number of hits in each database.

Example: Determine the number of records for mouse in Entrez.

https://eutils.ncbi.nlm.nih.gov/entrez/eutils/egquery.fcgi?term=mouse[orgn]

For More Information

Please see EGQuery In-Depth for a full description of EGQuery.

Sample EGQuery Output mouse[orgn] pubmed PubMed 0 Term or Database is not found pmc PMC 3823 Ok ... nuccore Nucleotide 1739903 Ok nucgss GSS 2264567 Ok nucest EST 4852140 Ok protein Protein 255212 Ok ... proteinclusters Protein Clusters 13 Ok Retrieving Spelling Suggestionsespell.fcgi?term=&db=

Input: Entrez text query (&term); Entrez database (&db)

Output: XML containing the original query and spelling suggestions.

Example: Find spelling suggestions for the PubMed Central query ‘fiberblast cell grwth’.

https://eutils.ncbi.nlm.nih.gov/entrez/eutils/espell.fcgi?term=fiberblast+cell+grwth&db=pmc

For More Information

Please see ESpell In-Depth for a full description of EGQuery.

Sample ESpell Outputpmcfiberblast cell grwthfibroblast cell growth fibroblast cell growthDemonstration ProgramsEBot

EBot is an interactive web tool that first allows users to construct an arbitrary E-utility analysis pipeline and then generates a Perl script to execute the pipeline. The Perl script can be downloaded and executed on any computer with a Perl installation. For more details, see the EBot page linked above.

Sample Perl Scripts

The two sample Perl scripts below demonstrate basic E-utility functions. Both scripts should be copied and saved as plain text files and can be executed on any computer with a Perl installation.

ESearch-EFetch demonstrates basic search and retrieval functions.

#!/usr/local/bin/perl -w# =======================================================================## PUBLIC DOMAIN NOTICE# National Center for Biotechnology Information## This software/database is a "United States Government Work" under the# terms of the United States Copyright Act. It was written as part of# the author's official duties as a United States Government employee and# thus cannot be copyrighted. This software/database is freely available# to the public for use. The National Library of Medicine and the U.S.# Government have not placed any restriction on its use or reproduction.## Although all reasonable efforts have been taken to ensure the accuracy# and reliability of the software and data, the NLM and the U.S.# Government do not and cannot warrant the performance or results that# may be obtained by using this software or data. The NLM and the U.S.# Government disclaim all warranties, express or implied, including# warranties of performance, merchantability or fitness for any particular# purpose.## Please cite the author in any work or product based on this material.## =======================================================================## Author: Oleg Khovayko## File Description: eSearch/eFetch calling example# # ---------------------------------------------------------------------# Subroutine to prompt user for variables in the next sectionsub ask_user { print "$_[0] [$_[1]]: "; my $rc = ; chomp $rc; if($rc eq "") { $rc = $_[1]; } return $rc;}# ---------------------------------------------------------------------# Define library for the 'get' function used in the next section.# $utils contains route for the utilities.# $db, $query, and $report may be supplied by the user when prompted; # if not answered, default values, will be assigned as shown below.use LWP::Simple;my $utils = "https://www.ncbi.nlm.nih.gov/entrez/eutils";my $db = ask_user("Database", "Pubmed");my $query = ask_user("Query", "zanzibar");my $report = ask_user("Report", "abstract");# ---------------------------------------------------------------------# $esearch cont?ins the PATH & parameters for the ESearch call# $esearch_result containts the result of the ESearch call# the results are displayed ?nd parsed into variables # $Count, $QueryKey, and $WebEnv for later use and then displayed.my $esearch = "$utils/esearch.fcgi?" . "db=$db&retmax=1&usehistory=y&term=";my $esearch_result = get($esearch . $query);print "\nESEARCH RESULT: $esearch_result\n";$esearch_result =~ m|(\d+).*(\d+).*(\S+)|s;my $Count = $1;my $QueryKey = $2;my $WebEnv = $3;print "Count = $Count; QueryKey = $QueryKey; WebEnv = $WebEnv\n";# ---------------------------------------------------------------------# this area defines a loop which will display $retmax citation results from # Efetch each time the the Enter Key is pressed, after a prompt.my $retstart;my $retmax=3;for($retstart = 0; $retstart < $Count; $retstart += $retmax) { my $efetch = "$utils/efetch.fcgi?" . "rettype=$report&retmode=text&retstart=$retstart&retmax=$retmax&" . "db=$db&query_key=$QueryKey&WebEnv=$WebEnv"; print "\nEF_QUERY=$efetch\n"; my $efetch_result = get($efetch); print "---------\nEFETCH RESULT(". ($retstart + 1) . ".." . ($retstart + $retmax) . "): ". "[$efetch_result]\n-----PRESS ENTER!!!-------\n"; ;}

EPost-ESummary demonstrates basic uploading and document summary retrieval.

#!/usr/local/bin/perl -w# =======================================================================## PUBLIC DOMAIN NOTICE# National Center for Biotechnology Information## This software/database is a "United States Government Work" under the# terms of the United States Copyright Act. It was written as part of# the author's official duties as a United States Government employee and# thus cannot be copyrighted. This software/database is freely available# to the public for use. The National Library of Medicine and the U.S.# Government have not placed any restriction on its use or reproduction.## Although all reasonable efforts have been taken to ensure the accuracy# and reliability of the software and data, the NLM and the U.S.# Government do not and cannot warrant the performance or results that# may be obtained by using this software or data. The NLM and the U.S.# Government disclaim all warranties, express or implied, including# warranties of performance, merchantability or fitness for any particular# purpose.## Please cite the author in any work or product based on this material.## =======================================================================## Author: Oleg Khovayko## File Description: ePost/eSummary calling example# # ---------------------------------------------------------------------my $eutils_root = "https://www.ncbi.nlm.nih.gov/entrez/eutils";my $ePost_url = "$eutils_root/epost.fcgi";my $eSummary_url = "$eutils_root/esummary.fcgi";my $db_name = "PubMed";# ---------------------------------------------------------------------use strict;use LWP::UserAgent;use LWP::Simple;use HTTP::Request;use HTTP::Headers;use CGI;# ---------------------------------------------------------------------# Read input file into variable $file# File name - forst argument $ARGV[0]undef $/; #for load whole fileopen IF, $ARGV[0] || die "Can't open for read: $!\n";my $file = ;close IF;print "Loaded file: [$file]\n";# Prepare file - substitute all separators to comma$file =~ s/\s+/,/gs;print "Prepared file: [$file]\n";#Create CGI param linemy $form_data = "db=$db_name&id=$file";# ---------------------------------------------------------------------# Create HTTP requestmy $headers = new HTTP::Headers( Accept => "text/html, text/plain", Content_Type => "application/x-www-form-urlencoded");my $request = new HTTP::Request("POST", $ePost_url, $headers );$request->content($form_data);# Create the user agent objectmy $ua = new LWP::UserAgent;$ua->agent("ePost/example");# ---------------------------------------------------------------------# send file to ePost by HTTPmy $response = $ua->request($request);# ---------------------------------------------------------------------print "Responce status message: [" . $response->message . "]\n";print "Responce content: [" . $response->content . "]\n";# ---------------------------------------------------------------------# Parse response->content and extract QueryKey & WebEnv$response->content =~ m|(\d+).*(\S+)|s;my $QueryKey = $1;my $WebEnv = $2;print "\nEXTRACTED:\nQueryKey = $QueryKey;\nWebEnv = $WebEnv\n\n";# ---------------------------------------------------------------------# Retrieve DocSum from eSummary by simple::get method and print it#print "eSummary result: [" . get("$eSummary_url?db=$db_name&query_key=$QueryKey&WebEnv=$WebEnv") . "]\n";For More InformationAnnouncement Mailing List

NCBI posts general announcements regarding the E-utilities to the utilities-announce announcement mailing list. This mailing list is an announcement list only; individual subscribers may not send mail to the list. Also, the list of subscribers is private and is not shared or used in any other way except for providing announcements to list members. The list receives about one posting per month. Please subscribe at the above link.

Getting Help

Please refer to the PubMed and Entrez help documents for more information about search queries, database indexing, field limitations and database content.

Suggestions, comments, and questions specifically relating to the EUtility programs may be sent to vog.hin.mln.ibcn@seitilitue.



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

      专题文章
        CopyRight 2018-2019 实验室设备网 版权所有